<template>
  <div>
  <a-layout id="components-layout-demo-custom-trigger">
    <a-layout-sider v-model="collapsed" :trigger="null" collapsible>
      <div class="logo" />
      <a-menu theme="dark" mode="inline" :default-selected-keys=defaults>
        <a-menu-item key="1">
          <a-icon type="user" />
          <span><router-link to="/user">用户管理</router-link></span>
        </a-menu-item>
        <a-menu-item key="2">
          <a-icon type="video-camera" />
          <span><router-link to="/detail">用户详情</router-link></span>
        </a-menu-item>
        <a-menu-item key="3">
          <a-icon type="upload" />
          <span><router-link to="/authority">权限管理</router-link></span>
        </a-menu-item>
        <a-menu-item key="4">
          <a-icon type="upload" />
          <span><router-link to="/CreateWork">工单管理</router-link></span>
        </a-menu-item>

        <a-menu-item key="5" class="a1">
          <a-icon type="edit"/>
          <a-badge :count="messages" class="a2">
            <a href="#" class="head-example" />
          </a-badge>
          <span><router-link to="/audit_workorder">审核工单</router-link></span>
        </a-menu-item>

        <a-menu-item key="6">
          <a-icon type="upload" />
          <span><router-link to="/work_detail">工单详情</router-link></span>
        </a-menu-item>
        <a-menu-item key="7">
          <a-icon type="upload" />
          <span><router-link to="/message_show">点咱查看全部消息</router-link></span>
        </a-menu-item>
        <a-menu-item key="8">
          <a-icon type="upload" />
          <span><router-link to="/socket">咨询客服</router-link></span>
        </a-menu-item>



      </a-menu>
    </a-layout-sider>
    <a-layout>
      <a-layout-header style="background: #fff; padding: 0">
        <a-icon
          class="trigger"
          :type="collapsed ? 'menu-unfold' : 'menu-fold'"
          @click="() => (collapsed = !collapsed)"
        />
      </a-layout-header>
      <a-layout-content :style="{ margin: '24px 16px', padding: '24px', background: '#fff', minHeight: '280px' }">
        <router-view></router-view>
      </a-layout-content>
    </a-layout>
  </a-layout>
  </div>
</template>
<script>



export default {
  data() {
    return {
      collapsed: false,
      // data:[],
      // columns,
      defaults:['1'],
      messages:'',
    }
  },
  created() {
    this.$axios({
      url:'http://127.0.0.1:8000/z/message/?uid='+localStorage.getItem('uid')
    }).then(res =>{
      console.log(res.data)
      this.messages = res.data.count
    })
  }
};
</script>
<style>
#components-layout-demo-custom-trigger .trigger {
  font-size: 18px;
  line-height: 64px;
  padding: 0 24px;
  cursor: pointer;
  transition: color 0.3s;
}

#components-layout-demo-custom-trigger .trigger:hover {
  color: #1890ff;
}

#components-layout-demo-custom-trigger .logo {
  height: 32px;
  background: rgba(255, 255, 255, 0.2);
  margin: 16px;
}

.a1{
  position: absolute;
}
.a2{
  position: relative;
  top: -10px;
  right: -75px;
}

</style>
